home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Utilities / Programming / MT2ToolKit 1.0b1 / Gener < prev    next >
Text File  |  1995-10-09  |  1KB  |  68 lines

  1. # --------------------------------------------------
  2. #    MT2ToolKit, version 1.0b1
  3. #    (C) Copyright by Michael Trofimov, 10/6/95.
  4. # --------------------------------------------------
  5. # Gener
  6. # generate array initialization template
  7. # Usage :
  8. #             Gener {name} {from} {to} {from} {to}
  9. # Or
  10. #            commando Gener
  11. # Or select "Generate array" item in Pascal menu.
  12. #
  13. # Example 1 :
  14. #  -- the command :
  15. #
  16. #             gener theArray 1 2 3 4
  17. #
  18. #      generates  a text:
  19. #
  20. #            theArray [1,3] := {%%};  theArray [1,4] := {%%};  
  21. #            theArray [2,3] := {%%};  theArray [2,4] := {%%};  
  22. # Example 2 :
  23. #  -- the command :
  24. #
  25. #             gener myArray -1 2
  26. #
  27. #      generates  a text:
  28. #
  29. #            myArray [-1] := {%%};  
  30. #            myArray [0] := {%%};  
  31. #            myArray [1] := {%%};  
  32. #            myArray [2] := {%%};  
  33.  
  34.  
  35. Set Exit 0
  36.  
  37. Set val  ∂{%%∂}
  38. Set j  "{2}"
  39. if "{5}" == ""
  40.  set from2 2
  41.  set to2 1
  42. Else
  43.  set from2 "{4}"
  44.  set to2 "{5}"
  45. End 
  46.  
  47.  
  48. Loop
  49.     Set i "{from2}"
  50.     Loop
  51.         if "{from2}" > "{to2}"
  52.             Echo "{1} [{j}] := {val}; " -n
  53.         Else            
  54.             Echo "{1} [{j},{i}] := {val}; " -n
  55.         End    
  56.         if "{i}" >= "{to2}"
  57.             Break
  58.         End
  59.         Evaluate i += 1
  60.     End    
  61.     if "{j}" >= "{3}"
  62.         Break
  63.     End
  64.     Evaluate j += 1
  65.     Echo 
  66. End
  67. Echo 
  68.